<%@ page import="bid.dao.UserDao" %>
<%@ page import="bid.dao.impl.UserDaoImpl" %>
<%@ page import="bid.entity.User" %><%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2023-10-25
  Time: 14:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
  <%
      request.setCharacterEncoding("utf-8");
      String name=request.getParameter("username");
      String pass=request.getParameter("pass");
      UserDao userDao=new UserDaoImpl();
      User user = userDao.login(name, pass);
      if(user==null){
          out.print("错误的用户名或者密码！<a href='login.jsp'>返回</a>");
          return;
      }
    session.setAttribute("LOGIN_USER",user);
  %>
 <script>
     alert("登录成功");
    // window.location="users.jsp";
     window.location="main.jsp";
 </script>
</body>
</html>
